<%-- 
    Document   : new
    Created on : 24-sep-2013, 15:58:15
    Author     : joelpacheco
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>GedeonMvc</title>
        <%@include file="../../template/estilos.jsp"%>
        <%@include file="../../template/script.jsp" %>

    </head>
    <body  class="page-header-fixed">
        <%@include file="../../template/header.jsp"%>
        <div class="page-container">
            <%@include file="../../template/sidebar.jsp"%>

            <div class="page-content">

                <%@include file="../../template/header_module.jsp"%>
                <div class="container-fluid">
                    <div class="row-fluid">

                        <div id="tab_1" class="tab-pane active">
                            <div class="portlet box blue">
                                <div class="portlet-title">
                                    <div class="caption"><i class="icon-reorder"></i>Form Sample</div>
                                    <div class="tools">
                                        <a class="collapse" href="javascript:;"></a>
                                        <a class="config" data-toggle="modal" href="#portlet-config"></a>
                                        <a class="reload" href="javascript:;"></a>
                                    </div>
                                </div>
                                <div class="portlet-body form">
                                    <!-- BEGIN FORM-->
                                    <form:form class="horizontal-form formdata" commandName="service" action="save" method="post">

                                        <div class="row-fluid">
                                            <div class="span6 ">
                                                <div class="control-group">
                                                    <!--<spring:message code="rol.new.name"/>-->
                                                    <label for="code" class="control-label">Codigo</label>
                                                    <div class="controls">
                                                        <form:input path="code" placeholder="Codigo del servicio"  class="m-wrap span4"></form:input>
                                                        <form:errors path="code" cssClass="m-wrap span2"></form:errors>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        <%
                                            String TOKEN = "abcdefghijklmnopqrstuvwxyz987654321ABCDFGHIJKLMNOPQRSTUVWXYZ$?";
                                            int count = TOKEN.length();

                                            Random random = new Random();
                                            StringBuilder stringBuilder = new StringBuilder("");
                                            for (int i = 0; i < count - 20; i++) {
                                                stringBuilder.append(TOKEN.charAt(random.nextInt(count)));
                                            }
                                        %>
                                        <input name="token" type="hidden" value="<%=stringBuilder.toString()%>"/>
                                        <div class="row-fluid">
                                            <!--/span-->
                                            <div class="span6">
                                                <div class="control-group">
                                                    <!--  <spring:message code="rol.new.description"/>-->
                                                    <label for="Nombre" class="control-label">Nombre</label>
                                                    <div class="controls">
                                                        <form:input path="name" placeholder="Nombre del servicio"  class="m-wrap span12"></form:input>
                                                        <form:errors path="name" cssClass="m-wrap span12"></form:errors>
                                                        </div>
                                                    </div>
                                                </div>
                                                <!--/span-->
                                            </div>
                                            <div class="row-fluid">
                                                <div class="control-group" id="select2-drop">
                                                    <label class="control-label"  >Proveedor : &nbsp;</label>
                                                    <div class="controls" >
                                                        <select class="span6 select_search" id="CboProvider" name="CboProvider" data-placeholder="Choose a Provider" tabindex="1">
                                                            <option value=""></option>
                                                        <c:forEach var="val" items="${provider}">
                                                            <option value="${val.id}">${val.name.trim()}</option>
                                                        </c:forEach> 
                                                    </select>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row-fluid">
                                            <div class="control-group" id="select2-drop">
                                                <label class="control-label"  ></label>
                                                <div class="controls" >

                                                </div>
                                            </div>
                                        </div>
                                        <!--/row-->

                                        <div class="form-actions">
                                            <button class="btn blue" type="submit"><i class="icon-ok"></i>Guardar</button>
                                            <button class="btn gray cleardata" type="button"><i class="icon-trash"></i>Clear</button>
                                            <a href="<c:url value='/service/index'/>" class="btn red">Cancelar</a>
                                            ${message}
                                        </div>
                                        <c:forEach var="system" items="${dataSystem}"> 
                                            <input type="hidden" value="${system.id}" name="createdBy" id="createdBy" /> 
                                            <input type="hidden" value="${system.id}" name="ownerId" id="ownerId" /> 

                                        </c:forEach>  
                                    </form:form>
                                    <!-- END FORM--> 
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <%@include file="../../template/footer.jsp"%>
    </body>
</html>
